
import Head from 'next/head'

<Head>
  <script>
    {
      `(function() {
         var _hmt = _hmt || [];
(function() {
  var hm = document.createElement("script");
  hm.src = "https://hm.baidu.com/hm.js?e60fb290e204e04c5cb6f79b0ac1e697";
  var s = document.getElementsByTagName("script")[0]; 
  s.parentNode.insertBefore(hm, s);
})();
       })();`
    }
  </script>
</Head>

![LangChain](https://pica.zhimg.com/50/v2-56e8bbb52aa271012541c1fe1ceb11a2_r.gif)



Llama-cpp嵌入
=============

本教程将介绍如何在LangChain中使用Llama-cpp嵌入。

```python
!pip install llama-cpp-python

```

```python
from langchain.embeddings import LlamaCppEmbeddings

```

```python
llama = LlamaCppEmbeddings(model_path="/path/to/model/ggml-model-q4_0.bin")

```

```python
text = "This is a test document."

```

```python
query_result = llama.embed_query(text)

```

```python
doc_result = llama.embed_documents([text])

```

